<?php


$colname_past4 = "-1";
if (isset($_GET['sa'])) {
  $colname_past4 = $_GET['sa'];
}
mysql_select_db($database_konek, $konek);
$query_past4 = sprintf("SELECT * FROM artikelplug WHERE id = %s", GetSQLValueString($colname_past4, "int"));
$past4 = mysql_query($query_past4, $konek) or die(mysql_error());
$row_past4 = mysql_fetch_assoc($past4);
$totalRows_past4 = mysql_num_rows($past4);
if ($totalRows_past4>0) {
$maxRows_past3 = $row_past4['perpage'];
$sc = 0;
if (isset($_GET['sc'])) {
  $sc = $_GET['sc'];
}
$startRow_past3 = $sc * $maxRows_past3;

$colname_past3 = "-1";
if (isset($row_past4['id'])) {
  $colname_past3 = $row_past4['id'];
}
$colname_ssc = "-1";
if (isset($_GET['sc'])) {
  $colname_ssc = $_GET['sc'];
}
mysql_select_db($database_konek, $konek);
$query_past3 = sprintf("SELECT * FROM artikelplug_data WHERE id_module = %s and id = %s", GetSQLValueString($colname_past3, "int"), GetSQLValueString($colname_ssc, "int"));
$query_limit_past3 = sprintf("%s LIMIT %d, %d", $query_past3, $startRow_past3, $maxRows_past3);
$past3 = mysql_query($query_past3, $konek) or die(mysql_error());
$row_past3 = mysql_fetch_assoc($past3);

if (isset($_GET['totalRows_past3'])) {
  $totalRows_past3 = $_GET['totalRows_past3'];
} else {
  $all_past3 = mysql_query($query_past3);
  $totalRows_past3 = mysql_num_rows($all_past3);
}
$totalPages_past3 = ceil($totalRows_past3/$maxRows_past3)-1;

$queryString_past3 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "sc") == false && 
        stristr($param, "totalRows_past2") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_past3 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_past3 = sprintf("&totalRows_past2=%d%s", $totalRows_past3, $queryString_past3);

mysql_select_db($database_konek,$konek);
$qry="UPDATE artikelplug_data SET view=".($row_past3['view']+1)." WHERE id=".$row_past3['id'];
$eksekusi=mysql_query($qry, $konek);
$currentPage = $_SERVER["PHP_SELF"];

?>


<div class="row">
<div class="col-md-4 col-lg-4">
 <a href="<?php echo $base_url ?>/g-konten/fm/artikel/<?php echo $row_past4['id']; ?>/<?php echo $row_past3['image']; ?>" class="fancybox-thumbs thumbnail" data-fancybox-group="thumb">
<img src="<?php echo $base_url ?>/g-konten/fm/artikel/<?php echo $row_past4['id']; ?>/<?php echo $row_past3['image']; ?>" alt="<?php echo $num++ ?>">
</a>
<?php

mysql_select_db($database_konek, $konek);
$query_allcate = "SELECT DISTINCT categori FROM artikelplug_data WHERE id_module = $row_past4[id]";
$allcate = mysql_query($query_allcate, $konek) or die(mysql_error());
$row_allcate = mysql_fetch_assoc($allcate);
$totalRows_allcate = mysql_num_rows($allcate);

echo '<div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title">
    Select Category <span class="caret"></h3>
  </div>
  <div class="panel-body">
  <span class="glyphicon glyphicon-chevron-right"></span> <a href="'.$base_url.'/p/'.$_GET['p'].'/category/'.$_GET['sa'].'/all/0">All Category</a><br>';
do { 

echo '<span class="glyphicon glyphicon-chevron-right"></span> <a href="'.$base_url.'/p/'.$_GET['p'].'/category/'.$_GET['sa'].'/'.str_replace(" ", "-", $row_allcate['categori']).'/0" '; if ($row_allcate['categori']==str_replace("-", " ", $_GET['sb'])){
echo $jen = ' active';
}; 
echo '">  '.$row_allcate['categori'].'</a><br>';
}while ($row_allcate = mysql_fetch_assoc($allcate));
echo '</div></div><div style="margin-bottom:10px"></div>';
mysql_free_result($allcate);
?>
</div>
<div class="col-md-8 col-lg-8">
	  <div class="<?php echo $classjudul; ?>">
<?php echo $row_past3['nama']; ?>
</div>
<div class="<?php echo $classcontent; ?>">
  <?php $num=0; ?>
  <small><?php echo tgl_indo($row_past3['tanggal']); ?> | dilihat :  <?php echo $row_past3['view']; ?> kali </small>
 <br />
<br />

    <p>

    <?php echo $row_past3['isi'] ?> </p>
</div>
    </div>
    </div>
<?php
mysql_free_result($past3);
}
mysql_free_result($past4);
?>
